home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 11 code / Async Sound Helper / SoundHelper / SoundHelper.h < prev   
Encoding:
Text File  |  1995-04-14  |  4.3 KB  |  101 lines  |  [TEXT/MPCC]

  1. //=======================================================================================
  2. //
  3. // SoundHelper.h - public header for the Asynchronous Sound Helper
  4. //
  5. // Written by Bryan K. Ressler (Beaker), 2/4/92
  6. //    Updated by Bradley D. Mohr, 2/4/95.
  7. //
  8. // Version 1.00, 2/4/92        Original version
  9. //         1.01, 2/20/92    Added SHGetState to fix handle semaphore problem
  10. //         1.02, 3/21/92    Make handle/error checks more explicit, modify
  11. //                             SHPlayStopByRec (to handle channels with no synthesizer)
  12. //         1.03, 4/4/92        Modifications per KO, RC, JR.  Public routines now pascal.
  13. //         1.04, 4/20/92    Reverted to SHPlayPause/SHPlayContinue structure.
  14. //           1.04a 2/4/95        Updated to work with Universal Headers & SM3.0 (BDM)
  15. //
  16. //=======================================================================================
  17.  
  18. //=======================================================================================
  19. // Includes
  20. //=======================================================================================
  21. #include "Std.h"
  22.  
  23. //=======================================================================================
  24. // Enumerated types
  25. //=======================================================================================
  26. typedef enum {
  27.     shpError = -1,
  28.     shpFinished = 0,
  29.     shpPaused = 1,
  30.     shpPlaying = 2
  31. } SHPlayStat;
  32.  
  33. typedef enum {
  34.     shrError = -1,
  35.     shrFinished = 0,
  36.     shrPaused = 1,
  37.     shrRecording = 2
  38. } SHRecordStat;
  39.  
  40. //=======================================================================================
  41. // Sound Helper error codes
  42. //=======================================================================================
  43. #define kSHErrOutaChannels        1        // No more output records are available
  44. #define kSHErrBadRefNum            2        // Invalid reference number
  45. #define kSHErrNonAsychDevice    3        // Input device can't handle asynchronous input
  46. #define kSHErrNoRecording        4        // There's no recording to return
  47. #define kSHErrNotRecording        5        // Not allowed because we're not recording
  48. #define kSHErrAlreadyPaused        6        // Already paused
  49. #define kSHErrAlreadyContinued    7        // Already continued
  50.  
  51. //=======================================================================================
  52. // Structures
  53. //=======================================================================================
  54. typedef struct {
  55.     SHRecordStat    recordStatus;        // Current record status
  56.     unsigned long    totalRecordTime;    // Total (maximum) record time in ms
  57.     unsigned long    currentRecordTime;    // Current recorded time in ms
  58.     short            meterLevel;            // 0..255, the current input level
  59. } SHRecordStatusRec;
  60.  
  61. //=======================================================================================
  62. // Initialization, idle, and termination
  63. //=======================================================================================
  64. pascal OSErr SHInitSoundHelper(Boolean *attnFlag, short numChannels);
  65. pascal void SHIdle(void);
  66. pascal void SHKillSoundHelper(void);
  67.  
  68. //=======================================================================================
  69. // Easy sound output
  70. //=======================================================================================
  71. pascal OSErr SHPlayByID(short resID, long *refNum);
  72. pascal OSErr SHPlayByHandle(Handle sound, long *refNum);
  73.  
  74. pascal OSErr SHPlayStop(long refNum);
  75. pascal OSErr SHPlayStopAll(void);
  76.  
  77. //=======================================================================================
  78. // Advanced sound output
  79. //=======================================================================================
  80. pascal OSErr SHPlayPause(long refNum);
  81. pascal OSErr SHPlayContinue(long refNum);
  82.  
  83. pascal SHPlayStat SHPlayStatus(long refNum);
  84. pascal OSErr SHGetChannel(long refNum, SndChannelPtr *channel);
  85.  
  86. //=======================================================================================
  87. // Easy sound input
  88. //=======================================================================================
  89. pascal OSErr SHRecordStart(short maxK, OSType quality, Boolean *doneFlag);
  90. pascal OSErr SHGetRecordedSound(Handle *theSound);
  91.  
  92. pascal OSErr SHRecordStop(void);
  93.  
  94. //=======================================================================================
  95. // Advanced sound input
  96. //=======================================================================================
  97. pascal OSErr SHRecordPause(void);
  98. pascal OSErr SHRecordContinue(void);
  99.  
  100. pascal OSErr SHRecordStatus(SHRecordStatusRec *recordStatus);
  101.